home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / ghostscr / gs252ini.zip / DRIVERS.DOC < prev    next >
Text File  |  1992-09-10  |  24KB  |  553 lines

  1.    Copyright (C) 1989, 1990, 1991, 1992 Aladdin Enterprises.
  2.      All rights reserved.
  3.    Distributed by Free Software Foundation, Inc.
  4.  
  5. This file is part of Ghostscript.
  6.  
  7. Ghostscript is distributed in the hope that it will be useful, but
  8. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  9. to anyone for the consequences of using it or for whether it serves any
  10. particular purpose or works at all, unless he says so in writing.  Refer
  11. to the Ghostscript General Public License for full details.
  12.  
  13. Everyone is granted permission to copy, modify and redistribute
  14. Ghostscript, but only under the conditions described in the Ghostscript
  15. General Public License.  A copy of this license is supposed to have been
  16. given to you along with Ghostscript so you can know your rights and
  17. responsibilities.  It should be in a file named COPYING.  Among other
  18. things, the copyright notice and this notice must be preserved on all
  19. copies.
  20.  
  21. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  22.  
  23. This file, drivers.doc, describes the interface between Ghostscript and
  24. device drivers.
  25.  
  26. For an overview of Ghostscript and a list of the documentation files, see
  27. README.
  28.  
  29. ********
  30. ******** Adding a driver ********
  31. ********
  32.  
  33. To add a driver to Ghostscript, all you need to do is edit devs.mak in
  34. two places.  The first is the list of devices, in the section headed
  35. # -------------------------------- Catalog ------------------------------- #
  36. Pick a name for your device, say smurf, and add smurf to the list.
  37. (Device names must be 1 to 8 characters, consisting of only letters,
  38. digits, and underscores, of which the first character must be a letter.
  39. Case is significant: all current device names are lower case.)
  40. The second is the section headed
  41. # ---------------------------- Device drivers ---------------------------- #
  42. Suppose the files containing the smurf driver are called joe and fred.
  43. Then you should add the following lines:
  44.  
  45. # ------ The SMURF device ------ #
  46.  
  47. smurf_=joe.$(OBJ) fred.$(OBJ)
  48. smurf.dev: $(smurf_)
  49.     $(SHP)gssetdev smurf $(smurf_)
  50.  
  51. joe.$(OBJ): joe.c ...and whatever it depends on
  52.  
  53. fred.$(OBJ): fred.c ...and whatever it depends on
  54.  
  55. If the smurf driver also needs special libraries, e.g., a library named
  56. gorf, then the gssetdev line should look like
  57.     $(SHP)gssetdev smurf $(smurf_)
  58.     $(SHP)gsaddmod smurf -lib gorf
  59.  
  60. ********
  61. ******** Driver structure ********
  62. ********
  63.  
  64. A device is represented by a structure divided into three parts:
  65.  
  66.     - procedures that are shared by all instances of each device;
  67.  
  68.     - parameters that are present in all devices but may be different
  69.       for each device or instance; and
  70.  
  71.     - device-specific parameters that may be different for each instance.
  72.  
  73. Normally, the procedure structure is defined and initialized at compile
  74. time.  A prototype of the parameter structure (including both generic and
  75. device-specific parameters) is defined and initialized at compile time,
  76. but is copied and filled in when an instance of the device is created.
  77.  
  78. The gx_device_common macro defines the common structure elements, with the
  79. intent that devices define and export a structure along the following
  80. lines:
  81.  
  82.     typedef struct smurf_device_s {
  83.         gx_device_common;
  84.         ... device-specific parameters ...
  85.     } smurf_device;
  86.     smurf_device gs_smurf_device = {
  87.         sizeof(smurf_device),        * params_size
  88.         { ... procedures ... },        * procs
  89.         ... generic parameter values ...
  90.         ... device-specific parameter values ...
  91.     };
  92.  
  93. The device structure instance *must* have the name gs_smurf_device, where
  94. smurf is the device name used in devs.mak.
  95.  
  96. All the device procedures are called with the device as the first
  97. argument.  Since each device type is actually a different structure type,
  98. the device procedures must be declared as taking a gx_device * as their
  99. first argument, and must cast it to smurf_device * internally.  For
  100. example, in the code for the "memory" device, the first argument to all
  101. routines is called dev, but the routines actually use md to reference
  102. elements of the full structure, by virtue of the definition
  103.  
  104.     #define md ((gx_device_memory *)dev)
  105.  
  106. (This is a cheap version of "object-oriented" programming: in C++, for
  107. example, the cast would be unnecessary, and in fact the procedure table
  108. would be constructed by the compiler.)
  109.  
  110. Structure definition
  111. --------------------
  112.  
  113. This essentially duplicates the structure definition in gxdevice.h.
  114.  
  115. typedef struct gx_device_s {
  116.     int params_size;        /* size of this structure */
  117.     gx_device_procs *procs;        /* pointer to procedure structure */
  118.     char *name;            /* the device name */
  119.     int width;            /* width in pixels */
  120.     int height;            /* height in pixels */
  121.     float x_pixels_per_inch;    /* x density */
  122.     float y_pixels_per_inch;    /* y density */
  123.     gs_rect margin_inches;        /* margins around imageable area, */
  124.                     /* in inches */
  125.     gx_device_color_info color_info;    /* color information */
  126.     int is_open;            /* true if device has been opened */
  127. } gx_device;
  128.  
  129. The name in the structure should be the same as the name in devs.mak.
  130.  
  131. gx_device_common is a macro consisting of just the element definitions.
  132.  
  133. If for any reason you need to change the definition of the basic device
  134. structure, or add procedures, you must change the following places:
  135.  
  136.     - This document and NEWS (if you want to keep the
  137.         documentation up to date).
  138.     - The definition of gx_device_common and/or the procedures
  139.         in gxdevice.h.
  140.     - The null device in gsdevice.c.
  141.     - The tracing "device" in gstdev.c.
  142.     - The "memory" devices in gdevmem.h and gdevmem*.c.
  143.     - The command list "device" in gxclist.c.
  144.     - The clip list accumulation and clipping "devices" in gxcpath.c.
  145.     - The generic printer device macros in gdevprn.h.
  146.     - The generic printer device code in gdevprn.c.
  147.     - All the real devices in the standard Ghostscript distribution,
  148.         as listed in devs.mak.  (Most of the printer devices are
  149.         created with the macros in gdevprn.h, so you may not have to
  150.         edit the source code for them.)
  151.     - Any other drivers you have that aren't part of the standard
  152.         Ghostscript distribution.
  153.  
  154. You may also have to change the code for gx_default_get_props and/or
  155. gx_default_put_props (in gsdevice.c).
  156.  
  157. ********
  158. ******** Types and coordinates ********
  159. ********
  160.  
  161. Coordinate system
  162. -----------------
  163.  
  164. Since each driver specifies the initial transformation from user to device
  165. coordinates, the driver can use any coordinate system it wants, as long as
  166. a device coordinate will fit in an int.  (This is only an issue on MS-DOS
  167. systems, where ints are only 16 bits.  User coordinates are represented as
  168. floats.)  Typically the coordinate system will have (0,0) in the upper
  169. left corner, with X increasing to the right and Y increasing toward the
  170. bottom.  This happens to be the coordinate system that all the currently
  171. supported devices use.  However, there is supposed to be nothing in the
  172. rest of Ghostscript that assumes this.
  173.  
  174. Drivers must check (and, if necessary, clip) the coordinate parameters
  175. given to them: they should not assume the coordinates will be in bounds.
  176.  
  177. Color definition
  178. ----------------
  179.  
  180. Ghostscript represents colors internally as RGB values.  In communicating
  181. with devices, however, it assumes that each device has a palette of colors
  182. identified by integers (to be precise, elements of type gx_color_index).
  183. Drivers may provide a uniformly spaced gray ramp or color cube for
  184. halftoning, or they may do their own color approximation, or both.
  185.  
  186. The color_info member of the device structure defines the color and
  187. gray-scale capabilities of the device.  Its type is defined as follows:
  188.  
  189. typedef struct gx_device_color_info_s {
  190.     int num_components;        /* 1 = gray only, 3 = RGB, */
  191.                     /* 4 = CMYK (not supported) */
  192.     int depth;            /* # of bits per pixel */
  193.     gx_color_value max_gray;    /* # of distinct gray levels -1 */
  194.     gx_color_value max_rgb;        /* # of distinct color levels -1 */
  195.                     /* (only relevant if num_comp. > 1) */
  196.     gx_color_value dither_gray;    /* size of gray ramp for halftoning */
  197.     gx_color_value dither_rgb;    /* size of color cube ditto */
  198.                     /* (only relevant if num_comp. > 1) */
  199. } gx_device_color_info;
  200.  
  201. The following macros (in gxdevice.h) provide convenient shorthands for
  202. initializing this structure for ordinary black-and-white or color devices:
  203.  
  204. #define dci_black_and_white { 1, 1, 1, 0, 2, 0 }
  205. #define dci_color(depth,maxv,dither) { 3, depth, maxv, maxv, dither, dither }
  206.  
  207. The idea is that a device has a certain number of gray levels (max_gray
  208. +1) and a certain number of colors (max_rgb +1) that it can produce
  209. directly.  When Ghostscript wants to render a given RGB color as a device
  210. color, it first tests whether the color is a gray level.  (If
  211. num_components is 1, it converts all colors to gray levels.)  If so:
  212.  
  213.     - If max_gray is large (>= 31), Ghostscript asks the device to
  214. approximate the gray level directly.  If the device returns a
  215. gx_color_value, Ghostscript uses it.  Otherwise, Ghostscript assumes that
  216. the device can represent dither_gray distinct gray levels, equally spaced
  217. along the diagonal of the color cube, and uses the two nearest ones to the
  218. desired color for halftoning.
  219.  
  220. If the color is not a gray level:
  221.  
  222.     - If max_rgb is large (>= 31), Ghostscript asks the device to
  223. approximate the color directly.  If the device returns a
  224. gx_color_value, Ghostscript uses it.  Otherwise, Ghostscript assumes
  225. that the device can represent dither_rgb * dither_rgb * dither_rgb
  226. distinct colors, equally spaced throughout the color cube, and uses
  227. two of the nearest ones to the desired color for halftoning.
  228.  
  229. Types
  230. -----
  231.  
  232. Here is a brief explanation of the various types that appear as parameters
  233. or results of the drivers.
  234.  
  235. gx_color_value (defined in gxdevice.h)
  236.  
  237.     This is the type used to represent RGB color values.  It is
  238. currently equivalent to unsigned short.  However, Ghostscript may use less
  239. than the full range of the type to represent color values:
  240. gx_color_value_bits is the number of bits actually used, and
  241. gx_max_color_value is the maximum value (equal to
  242. 2^gx_max_color_value_bits - 1).
  243.  
  244. gx_device (defined in gxdevice.h)
  245.  
  246.     This is the device structure, as explained above.
  247.  
  248. gs_matrix (defined in gsmatrix.h)
  249.  
  250.     This is a 2-D homogenous coordinate transformation matrix, used by
  251. many Ghostscript operators.
  252.  
  253. gx_color_index (defined in gxdevice.h)
  254.  
  255.     This is meant to be whatever the driver uses to represent a device
  256. color.  For example, it might be an index in a color map.  Ghostscript
  257. doesn't ever do any computations with these values: it gets them from
  258. map_rgb_color and hands them back as arguments to several other
  259. procedures.  The special value gx_no_color_index (defined as
  260. (gx_color_index)(-1)) means "transparent" for some of the procedures.  The
  261. type definition is simply:
  262.  
  263.     typedef unsigned long gx_color_index;
  264.  
  265. gs_prop_item (defined in gsprops.h)
  266.  
  267.     This is an element of a property list, which is used to read and
  268. set attributes in a device.  See the comments in gsprops.h, and the
  269. description of the get_props and put_props procedures below, for more
  270. detail.
  271.  
  272. gx_bitmap (defined in gxbitmap.h)
  273.  
  274.     This structure type represents a bitmap to be used as a tile for
  275. filling a region (rectangle).  Here is a copy of the relevant part of the
  276. file:
  277.  
  278. /*
  279.  * Structure for describing stored bitmaps.
  280.  * Bitmaps are stored bit-big-endian (i.e., the 2^7 bit of the first
  281.  * byte corresponds to x=0), as a sequence of bytes (i.e., you can't
  282.  * do word-oriented operations on them if you're on a little-endian
  283.  * platform like the Intel 80x86 or VAX).  Each scan line must start on
  284.  * a (32-bit) word boundary, and hence is padded to a word boundary,
  285.  * although this should rarely be of concern, since the raster and width
  286.  * are specified individually.  The first scan line corresponds to y=0
  287.  * in whatever coordinate system is relevant.
  288.  *
  289.  * For bitmaps used as halftone tiles, we may replicate the tile in
  290.  * X and/or Y, but it is still valuable to know the true tile dimensions.
  291.  */
  292. typedef struct gx_bitmap_s {
  293.     byte *data;
  294.     int raster;            /* bytes per scan line */
  295.     gs_int_point size;        /* width, height */
  296.     gx_bitmap_id id;
  297.     ushort rep_width, rep_height;    /* true size of tile */
  298. } gx_bitmap;
  299.  
  300. ********
  301. ******** Driver procedures ********
  302. ********
  303.  
  304. All the procedures that return int results return 0 on success, or an
  305. appropriate negative error code in the case of error conditions.  The
  306. error codes are defined in gserrors.h.  The relevant ones for drivers
  307. are as follows:
  308.  
  309.     gs_error_invalidfileaccess
  310.         An attempt to open a file failed.
  311.  
  312.     gs_error_limitcheck
  313.         An otherwise valid parameter value was too large for
  314.         the implementation.
  315.  
  316.     gs_error_rangecheck
  317.         A parameter was outside the valid range.
  318.  
  319.     gs_error_VMerror
  320.         An attempt to allocate memory failed.  (If this
  321.         happens, the procedure should release all memory it
  322.         allocated before it returns.)
  323.  
  324. If a driver does return an error, it should use the return_error
  325. macro rather than a simple return statement, e.g.,
  326.  
  327.     return_error(gs_error_VMerror);
  328.  
  329. This macro is defined in gx.h, which is automatically included by
  330. gdevprn.h but not by gserrors.h.
  331.  
  332. Most procedures are optional.  If a device doesn't supply an optional
  333. procedure proc, the entry in the procedure structure should be
  334. gx_default_proc, e.g. gx_default_tile_rectangle.  The device procedure
  335. must also call this procedure if it doesn't implement the function for
  336. particular values of the arguments.
  337.  
  338. Open/close/sync
  339. ---------------
  340.  
  341. int (*open_device)(P1(gx_device *)) [OPTIONAL]
  342.  
  343.     Open the device: do any initialization associated with making the
  344. device instance valid.  This must be done before any output to the device.
  345. The default implementation does nothing.
  346.  
  347. void (*get_initial_matrix)(P2(gx_device *, gs_matrix *)) [OPTIONAL]
  348.  
  349.     Construct the initial transformation matrix mapping user
  350. coordinates (nominally 1/72" per unit) to device coordinates.  The default
  351. procedure computes this from width, height, and x/y_pixels_per_inch on the
  352. assumption that the origin is in the upper left corner, i.e.
  353.         xx = x_pixels_per_inch/72, xy = 0,
  354.         yx = 0, yy = -y_pixels_per_inch/72,
  355.         tx = 0, ty = height.
  356.  
  357. int (*sync_output)(P1(gx_device *)) [OPTIONAL]
  358.  
  359.     Synchronize the device.  If any output to the device has been
  360. buffered, send / write it now.  Note that this may be called several times
  361. in the process of constructing a page, so printer drivers should NOT
  362. implement this by printing the page.  The default implementation does
  363. nothing.
  364.  
  365. int (*output_page)(P3(gx_device *, int num_copies, int flush)) [OPTIONAL]
  366.  
  367.     Output a fully composed page to the device.  The num_copies
  368. argument is the number of copies that should be produced for a hardcopy
  369. device.  (This may be ignored if the driver has some other way to specify
  370. the number of copies.)  The flush argument is true for showpage, false for
  371. copypage.  The default definition just calls sync_output.  Printer drivers
  372. should implement this by printing and ejecting the page.
  373.  
  374. int (*close_device)(P1(gx_device *)) [OPTIONAL]
  375.  
  376.     Close the device: release any associated resources.  After this,
  377. output to the device is no longer allowed.  The default implementation
  378. does nothing.
  379.  
  380. Color mapping
  381. -------------
  382.  
  383. gx_color_index (*map_rgb_color)(P4(gx_device *, gx_color_value red,
  384.   gx_color_value green, gx_color_value blue)) [OPTIONAL]
  385.  
  386.     Map a RGB color to a device color.  The range of legal values of
  387. the RGB arguments is 0 to gx_max_color_value.  The default algorithm
  388. returns 1 if any of the values exceeds gx_max_color_value/2, 0 otherwise.
  389.  
  390.     Ghostscript assumes that for devices that have color capability
  391. (i.e., color_info.num_components > 1), map_rgb_color returns a color index
  392. for a gray level (as opposed to a non-gray color) iff red = green = blue.
  393.  
  394. int (*map_color_rgb)(P3(gx_device *, gx_color_index color,
  395.   gx_color_value rgb[3])) [OPTIONAL]
  396.  
  397.     Map a device color code to RGB values.  The default algorithm
  398. returns (0 if color==0 else gx_max_color_value) for all three components.
  399.  
  400. Drawing
  401. -------
  402.  
  403. All drawing operations use device coordinates and device color values.
  404.  
  405. int (*fill_rectangle)(P6(gx_device *, int x, int y,
  406.   int width, int height, gx_color_index color))
  407.  
  408.     Fill a rectangle with a color.  The set of pixels filled is
  409. {(px,py) | x <= px < x + width and y <= py < y + height}.  In other words,
  410. the point (x,y) is included in the rectangle, as are (x+w-1,y), (x,y+h-1),
  411. and (x+w-1,y+h-1), but *not* (x+w,y), (x,y+h), or (x+w,y+h).  If width <=
  412. 0 or height <= 0, fill_rectangle should return 0 without drawing anything.
  413.  
  414. int (*draw_line)(P6(gx_device *, int x0, int y0, int x1, int y1,
  415.   gx_color_index color)) [OPTIONAL]
  416.  
  417.     Draw a minimum-thickness line from (x0,y0) to (x1,y1).  The
  418. precise set of points to be filled is defined as follows.  First, if y1 <
  419. y0, swap (x0,y0) and (x1,y1).  Then the line includes the point (x0,y0)
  420. but not the point (x1,y1).  If x0=x1 and y0=y1, draw_line should return 0
  421. without drawing anything.
  422.  
  423. Bitmap imaging
  424. --------------
  425.  
  426. Bitmap (or pixmap) images are stored in memory in a nearly standard way.
  427. The first byte corresponds to (0,0) in the image coordinate system: bits
  428. (or polybit color values) are packed into it left-to-right.  There may be
  429. padding at the end of each scan line: the distance from one scan line to
  430. the next is always passed as an explicit argument.
  431.  
  432. int (*copy_mono)(P11(gx_device *, const unsigned char *data, int data_x,
  433.   int raster, gx_bitmap_id id, int x, int y, int width, int height,
  434.   gx_color_index color0, gx_color_index color1))
  435.  
  436.     Copy a monochrome image (similar to the PostScript image
  437. operator).  Each scan line is raster bytes wide.  Copying begins at
  438. (data_x,0) and transfers a rectangle of the given width at height to the
  439. device at device coordinate (x,y).  (If the transfer should start at some
  440. non-zero y value in the data, the caller can adjust the data address by
  441. the appropriate multiple of the raster.)  The copying operation writes
  442. device color color0 at each 0-bit, and color1 at each 1-bit: if color0 or
  443. color1 is gx_no_color_index, the device pixel is unaffected if the image
  444. bit is 0 or 1 respectively.  If id is different from gx_no_bitmap_id, it
  445. identifies the bitmap contents unambiguously; a call with the same id will
  446. always have the same data, raster, and data contents.
  447.  
  448.     This operation is the workhorse for text display in Ghostscript,
  449. so implementing it efficiently is very important.
  450.  
  451. int (*tile_rectangle)(P10(gx_device *, const gx_bitmap *tile,
  452.   int x, int y, int width, int height,
  453.   gx_color_index color0, gx_color_index color1,
  454.   int phase_x, int phase_y)) [OPTIONAL]
  455.  
  456.     Tile a rectangle.  Tiling consists of doing multiple copy_mono
  457. operations to fill the rectangle with copies of the tile.  The tiles are
  458. aligned with the device coordinate system, to avoid "seams".
  459. Specifically, the (phase_x, phase_y) point of the tile is aligned with the
  460. origin of the device coordinate system.  (Note that this is backwards from
  461. the PostScript definition of halftone phase.)  phase_x and phase_y are
  462. guaranteed to be in the range [0..tile->width) and [0..tile->height)
  463. respectively.
  464.  
  465.     If color0 and color1 are both gx_no_color_index, then the tile is
  466. a color pixmap, not a bitmap: see the next section.
  467.  
  468. Pixmap imaging
  469. --------------
  470.  
  471. Pixmaps are just like bitmaps, except that each pixel occupies more than
  472. one bit.  All the bits for each pixel are grouped together (this is
  473. sometimes called "chunky" or "Z" format).  The number of bits per pixel is
  474. given by the color_info.depth parameter in the device structure: the legal
  475. values are 1, 2, 4, 8, 16, 24, or 32.  The pixel values are device color
  476. codes (i.e., whatever it is that map_rgb_color returns).
  477.  
  478. int (*copy_color)(P9(gx_device *, const unsigned char *data, int data_x,
  479.   int raster, gx_bitmap_id id, int x, int y, int width, int height))
  480.  
  481.     Copy a color image with multiple bits per pixel.  The raster is in
  482. bytes, but x and width are in pixels, not bits.  If the device doesn't
  483. actually support color, this is OPTIONAL; the default is equivalent to
  484. copy_mono with color0 = 0 and color1 = 1.  If id is different from
  485. gx_no_bitmap_id, it identifies the bitmap contents unambiguously; a call
  486. with the same id will always have the same data, raster, and data
  487. contents.
  488.  
  489. tile_rectangle can also take colored tiles.  This is indicated by the
  490. color0 and color1 arguments both being gx_no_color_index.  In this case,
  491. as for copy_color, the raster and height in the "bitmap" are interpreted
  492. as for real bitmaps, but the x and width are in pixels, not bits.
  493.  
  494. Reading bits back
  495. -----------------
  496.  
  497. int (*get_bits)(P5(gx_device *, int y,
  498.   byte *str, unsigned int size, int pad_to_word)) [OPTIONAL]
  499.  
  500.     Read bits back from the device into the area of size bytes
  501. starting at str, starting with scan line y.  If the bits cannot be read
  502. back (e.g., from a printer), return -1; otherwise return a value as
  503. described below.  The contents of the bits beyond the last valid bit in
  504. the scan line (as defined by the device width) are unpredictable.
  505.  
  506. If pad_to_word is 0, scan lines are only padded to a byte boundary; the
  507. normal return value is 0.
  508.  
  509. If pad_to_word is 1, scan lines are padded to a multiple of 4 bytes; the
  510. normal return value is 0.
  511.  
  512. If pad_to_word is -1, scan lines are padded to a multiple of 4 bytes, and
  513. in addition, the bytes may be swapped within a word.  The normal return
  514. value is 0 if no byte swapping is needed, 2 if bytes must be swapped
  515. within a 16-bit word, or 4 if bytes must be swapped within a 32-bit word.
  516.  
  517. Properties
  518. ----------
  519.  
  520. Devices may have an open-ended set of properties, which are simply pairs
  521. consisting of a name and a value.  The value may be of various types:
  522. integer, boolean, float, string, array of integer, or array of float.
  523.  
  524. Property lists are somewhat complex.  If your device has properties beyond
  525. those of a straightforward display or printer, we strongly advise using
  526. the code for the default implementation of get_props and put_props in
  527. gsdevice.c as a model for your own code.
  528.  
  529. int (*get_props)(P2(gx_device *dev, gs_prop_item *plist)) [OPTIONAL]
  530.  
  531.     Read all the properties of the device into the property list at
  532. plist.  Return the number of properties.  See gsprops.h for more details,
  533. gx_default_get_props in gsdevice.c for an example.
  534.  
  535.     If plist is NULL, just return the number of properties plus the
  536. total number of elements in all array-valued properties.  This is how the
  537. getdeviceprops operator finds out how much storage to allocate for the
  538. property list.
  539.     
  540. int (*put_props)(P3(gx_device *dev, gs_prop_item *plist,
  541.   int count)) [OPTIONAL]
  542.  
  543.     Set the properties of the device from the property list at plist.
  544. Return 0 if everything was OK, an error code
  545. (gs_error_undefined/typecheck/rangecheck/limitcheck) if some property had
  546. an invalid type or out-of-range value.  See gsprops.h for more details,
  547. gx_default_put_props in gsdevice.c for an example.
  548.  
  549.     Changing device properties may require closing the device and
  550. reopening it.  If this is the case, the put_props procedure should
  551. just close the device; a higher-level routine (gs_putdeviceprops)
  552. will reopen it.
  553.